package com.top.mall.jetpack.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.module.lemlin.http.HttpResponseBody
import com.module.lemlin.http.HttpResponseData
import com.module.lemlin.http.SubscribeViewModel
import com.top.mall.entity.CouponScoreResponse
import com.top.mall.entity.HomeIndexResponse
import com.top.mall.entity.UserCouponResponse
import com.top.mall.jetpack.ma.CouponManager
import com.top.mall.jetpack.ma.HomeManager
import com.top.mall.jetpack.vm.CartViewModel

class CouponViewModel(application: Application) : CartViewModel(application) {


    private val mCouponManager: CouponManager = CouponManager()

    val userCouponLiveData = MutableLiveData<HttpResponseBody<UserCouponResponse>>()
    fun userCoupon(source_type: Int) {
        setRxLifeScope(SubscribeViewModel(userCouponLiveData)) {
            mCouponManager.userCoupon(source_type)
        }
    }

    val userCouponScoreLiveData = MutableLiveData<HttpResponseBody<CouponScoreResponse>>()
    fun userCouponScore() {
        setRxLifeScope(SubscribeViewModel(userCouponScoreLiveData)) {
            mCouponManager.userCouponScore()
        }
    }

    val userCouponExchangeLiveData = MutableLiveData<HttpResponseBody<HttpResponseData>>()
    fun userCouponExchange(money: Int) {
        setRxLifeScope(SubscribeViewModel(userCouponExchangeLiveData)) {
            mCouponManager.userCouponExchange(money)
        }
    }
}